package com.shuai.jit.entity.user;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.factory.annotation.Autowired;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author joker
 * @since 2021-01-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel("用户类")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.ASSIGN_ID)
    @ApiModelProperty("用户id 唯一")
    private String id;

    @ApiModelProperty("用户名 唯一")
    @NotBlank
    private String username;

    @ApiModelProperty("密码")
    @NotNull
    private String password;

    @ApiModelProperty("盐")
    private String salt;

    @ApiModelProperty("0 表示刚注册 ，1 表示需要认证 ，2 表示认证成功")
    private Integer approve;

    @ApiModelProperty("学院")
    private String college;

    @ApiModelProperty("班级")
    private String classes;

    @ApiModelProperty("学号")
    private String number;

    @ApiModelProperty("验证码信息")
    @NotNull
    @TableField(exist = false)
    private String code;

    @ApiModelProperty("返回数据时，带的token")
    private String userImg;

    @ApiModelProperty("qq信息")
    private String qq;

    @ApiModelProperty("认证的图片展示")
    private String checkImg;

    @ApiModelProperty("级别名称")
    private String levName;

    @ApiModelProperty("真名")
    private String realName;

    @Email(message = "错误的邮箱格式")
    @ApiModelProperty("用户的邮箱")
    private String userEmail;

    @Pattern(regexp = "^1(3|4|5|7|8)\\d{9}$")
    @ApiModelProperty("用户电话")
    @NotNull
    private String userTelephone;


    @ApiModelProperty("用户的等级")
    private Integer userLev;

    @ApiModelProperty("用户简介")
    private String userIntroduce;

    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @ApiModelProperty("上次创建时间")
    @TableField(fill =FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified;

    @ApiModelProperty("乐观锁")
    @Version
    @TableField(fill = FieldFill.INSERT)
    private Integer version;

    @ApiModelProperty("逻辑是否删除")
    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer isDelete;

}
